const Menu = require("../../../../models/setting/menuModel.js");
const { buildErrObject } = require("../../../../utils/buildErrObject");
const insertMenu = function (req = {}) {
	return new Promise(async (resolve, reject) => {
		let data = {
			...req,
			// id: "Dou_menu_" + Math.random().toString(36).substr(2),
		};
		const menu = new Menu(data);
		menu.save((err, item) => {
			if (err) {
				reject(buildErrObject(422, err.message));
			}
			resolve(item);
		});
		return;
	});
};

module.exports = { insertMenu };
